#pragma once

#include "CControl.h"

NAMESPACE_UI_BEGIN

class UI_API CContainer : public CControl, public IContainer
{
public:
	CContainer();

public: // IControl
	const COID & GetOID() const;
	IContainer * GetContainer();
	void OnShow();
	void OnHide();

	void MouseMove(CMouseArgument & args);
	void MouseDown(CMouseArgument & args);
	void MouseClick(CMouseArgument & args);
	void MouseUp(CMouseArgument & args);
	void MouseIn(CMouseArgument & args);
	void MouseOut(CMouseArgument & args);
public: // IContainer
	IControl * GetControl();
	ILayerout * GetLayout();

	void AddControl(IControl * pControl);
	void RemoveControl(IControl * pControl);

	IControl * FindChild(const CPointInt32 & ptThis, int_32 findFlags = FindFlagNormal) const;
	bool FindChild(IControl * pControl) const;

	void SetMouseControl(IControl * pControl, const CPointInt32 & ptThis);
	IControl * GetMouseControl() const ;

	IControl * GetMouseControlDeeply() const;

	void SetFocusControl(IControl * pControl);
	IControl * GetFocusControl() const;

	IControl * GetFirstChild() { return m_pFirstChild;}

	bool SetCaptureControl(IControl * pControl);
	IControl * GetCaptureControl() const;

	void OnCheckedGroup(IGroup * pGroup);
protected:
	IControl * m_pFirstChild;
	IControl * m_pLastChild;

	IControl * m_pMouseControl;
	IControl * m_pFocusControl;

	ILayerout * m_pLayerout;

	IControl * m_pCaptureControl;
};

NAMESPACE_UI_END
